# 
include ../include.mk
PLT := heng.plt
INSTALL_DIR := /usr/local/heng

all: $(EBIN_FILES)

test: 
	$(MAKE) DEBUG=-DDEBUG
	$(ERL) -noshell -pa ../../ebin -s e2d_test -s init stop
    
$(PLT): $(EBIN_FILES)
	dialyzer -c $? --output_plt $@ $(shell if [ -f $@ ] ; then echo "--plt $@"; fi)

dialyze: $(PLT)

clean:
	rm -rf $(EBIN_FILES)
	rm -f $(PLT)

install:install-master install-worker

install-master: all
   @[ -n "$(INSTALL_DIR)" ] || (echo "Please set INSTALL_DIR."; false)
   mkdir -p $(INSTALL_DIR)
   mkdir -p $(INSTALL_DIR)/bin
   mkdir -p $(INSTALL_DIR)/etc
   mkdir -p $(INSTALL_DIR)/lib
   mkdir -p $(INSTALL_DIR)/share
   mkdir -p $(INSTALL_DIR)/var
   
   cp -r ./ebin $(INSTALL_DIR)/bin
   cp -r ./include $(INSTALL_DIR)/lib
   cp -r ./scripts $(INSTALL_DIR)/bin
   
install-worker: all
	    
    
uninstall: 
	rm -rf $(INSTALL_DIR)